Skip to content

Fix Stop() not stopping the cron scheduler - #86

Open
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/stop-scheduler-leak
Open

Fix Stop() not stopping the cron scheduler#86
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/stop-scheduler-leak

Conversation

@damilolaedwards

Copy link
Copy Markdown

Summary

Start built the job scheduler into a local variable and started it, but never assigned it to the node. Stop only ever calls n.crons.Stop(), so that check was always a no-op. Every cron job kept running after Stop, including health checks, sync status, node version and peer polling, and the scheduler goroutine itself leaked.

Fix assigns the scheduler to the node before starting it so Stop can actually stop it.

Test plan

  • Added TestStopStopsScheduler in pkg/beacon/beacon_test.go, running a real Start/Stop cycle against a fake client and checking the scheduler is actually stopped
  • Confirmed the test fails against the old code and passes against the fix
  • go build ./..., go vet ./..., go test ./... all green (this test is intentionally not run under -race: it hits an unrelated, pre-existing race inside the wallclock dependency's own ticker goroutine that triggers on any full Start() call, independent of this fix, and this repo's CI does not run tests with -race either)

Start built the job scheduler into a local variable and started it,
but never assigned it to the node so Stop() had nothing to call.
Every cron job kept running after Stop, including health checks,
sync status, node version and peer polling. Now the scheduler is
assigned before it starts so Stop can actually stop it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant